﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @RenderSection("styles", required: false)
    @Styles.Render("~/Content/theme")
    <style type="text/css">
        .update-message, .error-message {
            margin: 1px auto;
            padding: 2px 8px;
            border-width: 1px;
            border-style: solid;
            width: 500px;
            text-align: center;
        }
        .update-message {
            background-color: #ecf9ec;
            border-color: green;
        }
        .error-message {
            background-color: #feaeb7;
            border-color: darkred;
        }
    </style>
</head>
<body>
    <header>
        <h3>@Html.ActionLink("Build Runs", "Index", "Build")</h3> | 
        <h3>@Html.ActionLink("Build Schedules", "Index", "Schedule")</h3> |
        <h3>@Html.ActionLink("Build Definitions", "Index", "Definition")</h3> | 
        <h3>@Html.ActionLink("Build Templates", "Index", "Template")</h3>
        <h3 class="login">@Html.Partial("_Login")</h3>
    </header>
    <section class="messages" style="position: absolute; width: 100%">
        @{
            string errorMessage = ViewBag.ErrorMessage as string;
            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                <div class="error-message">@errorMessage</div>
            }
            string updateMessage = ViewBag.UpdateMessage as string;
            if (!string.IsNullOrWhiteSpace(updateMessage))
            {
                <div class="update-message">@updateMessage</div>
            }
        }
    </section>
    <section class="body">
    @RenderBody()
    </section>

    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)
    <script type="text/javascript">
        function RemoveNextMessage()
        {
            count = jQuery('section.messages :visible').size();
            jQuery('section.messages').delay(4000 * count).fadeOut('slow');
        }
        jQuery(document).ready(RemoveNextMessage);
    </script>
</body>
</html>
